package com.demo.example.hot100;

public class ClimbLadders {
    public static void main(String[] args) {
        System.out.println(climbStairs02(24));
    }
    //一次只能爬两步或者一步
    public static int climbStairs(int n){
        return process(0,n,0);
    }
    public static int climbStairs02(int n){
        int[] dp=new int[n];
        dp[0]=1;  //0为1
        dp[1]=2; //1为2
        if(n>2){
         for(int i=2;i<n;i++){
             dp[i]=dp[i-1]+dp[i-2];
         }
        }
        return dp[n-1];
    }
    public static int process(int start,int end,int now){
        if(now>end){
            return 0;
        }
        if(now==end){
            return 1;
        }
        return process(start,end,now+1)+process(start,end,now+2);
    }
}
